using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using NetWorkMsg;

namespace NetMsg.CrazyShopping
{
    // 订单摘要
    public struct OrderSummary : IUnPackable
    {
        // 游戏内订单号
        public long GameOrderId;
        // 快递单号
        public string OrderId;
        
        public void UnPack(MemoryStream stream)
        {
            UnPackAuxiliary.Read(stream, out ulong var0);
            GameOrderId = (long)var0;
            UnPackAuxiliary.Read(stream, out OrderId);
        }
    }
    
    // 获得败家信息
    public struct GetCrazyShoppingQ : IServerCallbackable
    {
        
        public uint UnPackableId => 126;
        public uint PackableId => 133;
        
        public void Pack(MemoryStream stream)
        {
            PackAuxiliary.Write(stream, 133u);
        }
    }
    
    public class GetCrazyShoppingP : IUnPackable
    {
        // 未完成订单
        public List<OrderSummary> Orders;
        
        public const uint Sid = 126;
        
        public void UnPack(MemoryStream stream)
        {
            UnPackAuxiliary.Read(stream, out uint var0);
            Orders = new List<OrderSummary>((int)var0);
            for(var i = 0; i < var0; ++i)
            {
                var var1 = new OrderSummary();
                var1.UnPack(stream);
                Orders.Add(var1);
            }
        }
    }
    
    // 确认订单
    public struct ConfirmOrderQ : IIdPackable
    {
        // 游戏内订单号
        public long OrderId;
        
        public uint PackableId => 134;
        
        public void Pack(MemoryStream stream)
        {
            PackAuxiliary.Write(stream, 134u);
            PackAuxiliary.Write(stream, (ulong)OrderId);
        }
    }
    
    // 可邮寄的卡牌信息
    public struct MailableCard : IUnPackable
    {
        // 卡牌Id
        public long CardId;
        // 配置Id
        public int CfgId;
        
        public void UnPack(MemoryStream stream)
        {
            UnPackAuxiliary.Read(stream, out ulong var0);
            CardId = (long)var0;
            UnPackAuxiliary.Read(stream, out uint var1);
            CfgId = (int)var1;
        }
    }
    
    // 订单信息
    public struct OrderInfo : IUnPackable
    {
        // 游戏内订单号
        public long GameOrderId;
        // 快递单号
        public string OrderId;
        // 卡牌
        public List<MailableCard> Cards;
        // 收获地址
        public string Address;
        // 创建时间
        public int CreateTime;
        // 关闭时的时间戳 0代表运输中
        public int CloseTime;
        
        public void UnPack(MemoryStream stream)
        {
            UnPackAuxiliary.Read(stream, out ulong var0);
            GameOrderId = (long)var0;
            UnPackAuxiliary.Read(stream, out OrderId);
            UnPackAuxiliary.Read(stream, out uint var1);
            Cards = new List<MailableCard>((int)var1);
            for(var i = 0; i < var1; ++i)
            {
                var var2 = new MailableCard();
                var2.UnPack(stream);
                Cards.Add(var2);
            }
            UnPackAuxiliary.ReadCompressible(stream, out Address);
            UnPackAuxiliary.Read(stream, out uint var3);
            CreateTime = (int)var3;
            UnPackAuxiliary.Read(stream, out uint var4);
            CloseTime = (int)var4;
        }
    }
    
    // 获得定点详情
    public struct GetOrderInfoQ : IServerCallbackable
    {
        // 游戏内订单号
        public long OrderId;
        
        public uint UnPackableId => 127;
        public uint PackableId => 135;
        
        public void Pack(MemoryStream stream)
        {
            PackAuxiliary.Write(stream, 135u);
            PackAuxiliary.Write(stream, (ulong)OrderId);
        }
    }
    
    public class GetOrderInfoP : IUnPackable
    {
        public OrderInfo OrderInfo;
        
        public const uint Sid = 127;
        
        public void UnPack(MemoryStream stream)
        {
            OrderInfo = new OrderInfo();
            OrderInfo.UnPack(stream);
        }
    }
    
    // 获得订单记录
    public struct GetOrderRecordsQ : IServerCallbackable
    {
        // 起始位置
        public int Start;
        // 拉取个数
        public int Number;
        
        public uint UnPackableId => 128;
        public uint PackableId => 136;
        
        public void Pack(MemoryStream stream)
        {
            PackAuxiliary.Write(stream, 136u);
            PackAuxiliary.Write(stream, (uint)Start);
            PackAuxiliary.Write(stream, (uint)Number);
        }
    }
    
    public class GetOrderRecordsP : IUnPackable
    {
        public List<OrderInfo> OrderInfos;
        
        public const uint Sid = 128;
        
        public void UnPack(MemoryStream stream)
        {
            UnPackAuxiliary.Read(stream, out uint var0);
            OrderInfos = new List<OrderInfo>((int)var0);
            for(var i = 0; i < var0; ++i)
            {
                var var1 = new OrderInfo();
                var1.UnPack(stream);
                OrderInfos.Add(var1);
            }
        }
    }
    
    // 商品信息 
    public struct CommodityInfo : IUnPackable
    {
        // 配置Id
        public int CfgId;
        // 商品剩余数量
        public int Number;
        
        public void UnPack(MemoryStream stream)
        {
            UnPackAuxiliary.Read(stream, out uint var0);
            CfgId = (int)var0;
            UnPackAuxiliary.Read(stream, out uint var1);
            Number = (int)var1;
        }
    }
    
    // 获得商店信息
    public struct GetStoreInfoQ : IServerCallbackable
    {
        
        public uint UnPackableId => 129;
        public uint PackableId => 137;
        
        public void Pack(MemoryStream stream)
        {
            PackAuxiliary.Write(stream, 137u);
        }
    }
    
    public class GetStoreInfoP : IUnPackable
    {
        // 剩余刷新次数
        public int RefreshTimes;
        public List<CommodityInfo> Infos;
        
        public const uint Sid = 129;
        
        public void UnPack(MemoryStream stream)
        {
            UnPackAuxiliary.Read(stream, out uint var0);
            RefreshTimes = (int)var0;
            UnPackAuxiliary.Read(stream, out uint var1);
            Infos = new List<CommodityInfo>((int)var1);
            for(var i = 0; i < var1; ++i)
            {
                var var2 = new CommodityInfo();
                var2.UnPack(stream);
                Infos.Add(var2);
            }
        }
    }
    
    // 购买商品结果
    public enum BuyCommodityResult
    {
        Success,
        // 没有商品了
        NoMore,
        // 钱不够
        NoMoney,
    }
    
    // 购买商品
    public struct BuyCommodityQ : IServerCallbackable
    {
        public int CfgId;
        
        public uint UnPackableId => 130;
        public uint PackableId => 138;
        
        public void Pack(MemoryStream stream)
        {
            PackAuxiliary.Write(stream, 138u);
            PackAuxiliary.Write(stream, (uint)CfgId);
        }
    }
    
    public struct BuyCommodityP : IUnPackable
    {
        public BuyCommodityResult Result;
        
        public const uint Sid = 130;
        
        public void UnPack(MemoryStream stream)
        {
            UnPackAuxiliary.Read(stream, out uint var0);
            Result = (BuyCommodityResult)var0;
        }
    }
    
    // 刷新商店
    public struct RefreshStoreQ : IServerCallbackable
    {
        
        public uint UnPackableId => 131;
        public uint PackableId => 139;
        
        public void Pack(MemoryStream stream)
        {
            PackAuxiliary.Write(stream, 139u);
        }
    }
    
    public class RefreshStoreP : IUnPackable
    {
        // 数组长度为0就是刷新失败，理论上不存在
        public List<CommodityInfo> Infos;
        
        public const uint Sid = 131;
        
        public void UnPack(MemoryStream stream)
        {
            UnPackAuxiliary.Read(stream, out uint var0);
            Infos = new List<CommodityInfo>((int)var0);
            for(var i = 0; i < var0; ++i)
            {
                var var1 = new CommodityInfo();
                var1.UnPack(stream);
                Infos.Add(var1);
            }
        }
    }
    
    // 获取邮递信息
    public struct GetPostInfoQ : IServerCallbackable
    {
        
        public uint UnPackableId => 132;
        public uint PackableId => 140;
        
        public void Pack(MemoryStream stream)
        {
            PackAuxiliary.Write(stream, 140u);
        }
    }
    
    public struct GetPostInfoP : IUnPackable
    {
        // 邮费
        public int Gold;
        // 快递卷
        public int Ticket;
        // 快速签到冷却时间戳
        public int SignTime;
        // 广告签到时间
        public int AdSignTime;
        
        public const uint Sid = 132;
        
        public void UnPack(MemoryStream stream)
        {
            UnPackAuxiliary.Read(stream, out uint var0);
            Gold = (int)var0;
            UnPackAuxiliary.Read(stream, out uint var1);
            Ticket = (int)var1;
            UnPackAuxiliary.Read(stream, out uint var2);
            SignTime = (int)var2;
            UnPackAuxiliary.Read(stream, out uint var3);
            AdSignTime = (int)var3;
        }
    }
    
    // 快速签到
    public struct SignQ : IIdPackable
    {
        
        public uint PackableId => 141;
        
        public void Pack(MemoryStream stream)
        {
            PackAuxiliary.Write(stream, 141u);
        }
    }
    
    // 广告签到
    public struct AdSignQ : IIdPackable
    {
        
        public uint PackableId => 142;
        
        public void Pack(MemoryStream stream)
        {
            PackAuxiliary.Write(stream, 142u);
        }
    }
    
    // 收获地址信息
    public class AddressInfo : IPackable, IUnPackable
    {
        // 姓名
        public string Name;
        // 电话
        public string Phone;
        // 地址
        public string Address;
        // 门牌号
        public string Door;
        
        public void Pack(MemoryStream stream)
        {
            PackAuxiliary.Write(stream, Name);
            PackAuxiliary.Write(stream, Phone);
            PackAuxiliary.Write(stream, Address);
            PackAuxiliary.Write(stream, Door);
        }
        
        public void UnPack(MemoryStream stream)
        {
            UnPackAuxiliary.Read(stream, out Name);
            UnPackAuxiliary.Read(stream, out Phone);
            UnPackAuxiliary.Read(stream, out Address);
            UnPackAuxiliary.Read(stream, out Door);
        }
    }
    
    // 获得地址信息
    public struct GetAddressInfosQ : IServerCallbackable
    {
        
        public uint UnPackableId => 133;
        public uint PackableId => 143;
        
        public void Pack(MemoryStream stream)
        {
            PackAuxiliary.Write(stream, 143u);
        }
    }
    
    public class GetAddressInfosP : IUnPackable
    {
        public List<AddressInfo> Address;
        
        public const uint Sid = 133;
        
        public void UnPack(MemoryStream stream)
        {
            UnPackAuxiliary.Read(stream, out uint var0);
            Address = new List<AddressInfo>((int)var0);
            for(var i = 0; i < var0; ++i)
            {
                var var1 = new AddressInfo();
                var1.UnPack(stream);
                Address.Add(var1);
            }
        }
    }
    
    // 添加收获地址结果
    public enum AddAddressResult
    {
        // 成功
        Success,
        // 地址满了
        Full,
    }
    
    // 添加收货地址
    public class AddAddressQ : IServerCallbackable
    {
        public AddressInfo Address;
        
        public uint UnPackableId => 134;
        public uint PackableId => 144;
        
        public void Pack(MemoryStream stream)
        {
            PackAuxiliary.Write(stream, 144u);
            Address.Pack(stream);
        }
    }
    
    public struct AddAddressP : IUnPackable
    {
        public AddAddressResult Result;
        
        public const uint Sid = 134;
        
        public void UnPack(MemoryStream stream)
        {
            UnPackAuxiliary.Read(stream, out uint var0);
            Result = (AddAddressResult)var0;
        }
    }
    
    // 删除收货地址
    public struct DelAddressQ : IIdPackable
    {
        // 在列表中的位置
        public int Index;
        
        public uint PackableId => 145;
        
        public void Pack(MemoryStream stream)
        {
            PackAuxiliary.Write(stream, 145u);
            PackAuxiliary.Write(stream, (uint)Index);
        }
    }
    
    // 修改收货地址
    public class ModifyAddressQ : IIdPackable
    {
        public int Index;
        public AddressInfo Address;
        
        public uint PackableId => 146;
        
        public void Pack(MemoryStream stream)
        {
            PackAuxiliary.Write(stream, 146u);
            PackAuxiliary.Write(stream, (uint)Index);
            Address.Pack(stream);
        }
    }
    
    // 邮寄消耗类型
    public enum PostCostType
    {
        Gold,
        Ticket,
    }
    
    // 邮寄生成结果
    public enum MakeOrderResult
    {
        Success,
        // 卡牌不存在
        CarNotExists,
        // 钱不够
        NoMoney,
        // 地址错误
        AddressError,
    }
    
    // 生成一个订单
    public class MakeOrderQ : IServerCallbackable
    {
        // 选择的卡牌
        public List<long> Cards;
        // 地址索引
        public int Address;
        // 支付方式
        public PostCostType Cost;
        
        public uint UnPackableId => 135;
        public uint PackableId => 147;
        
        public void Pack(MemoryStream stream)
        {
            PackAuxiliary.Write(stream, 147u);
            PackAuxiliary.Write(stream, (uint)Cards.Count);
            for(var i = 0; i < Cards.Count; ++i)
                PackAuxiliary.Write(stream, (ulong)Cards[i]);
            PackAuxiliary.Write(stream, (uint)Address);
            PackAuxiliary.Write(stream, (uint)Cost);
        }
    }
    
    public struct MakeOrderP : IUnPackable
    {
        // 游戏内订单号
        public long OrderId;
        // 结果
        public MakeOrderResult Result;
        
        public const uint Sid = 135;
        
        public void UnPack(MemoryStream stream)
        {
            UnPackAuxiliary.Read(stream, out ulong var0);
            OrderId = (long)var0;
            UnPackAuxiliary.Read(stream, out uint var1);
            Result = (MakeOrderResult)var1;
        }
    }
    
    public enum CrazyShoppingEnum
    {
        GetCrazyShoppingP,
        GetOrderInfoP,
        GetOrderRecordsP,
        GetStoreInfoP,
        BuyCommodityP,
        RefreshStoreP,
        GetPostInfoP,
        GetAddressInfosP,
        AddAddressP,
        MakeOrderP,
    }
}
